Raphaël (JavaScript library)

Raphaël
Developer(s) Dmitry Baranovskiy
Stable release 2.0 / October 1, 2011; 4 months ago (2011-10-01)
Written in JavaScript
License MIT License
Website http://raphaeljs.com/

Raphaël is a cross-browser JavaScript library that draws vector graphics for web sites. It will use SVG for most browsers, but will use VML for older versions of Internet Explorer. Raphaël currently supports Firefox 3.0+, Safari 3.0+, Opera 9.5+ and Internet Explorer 6.0+.

Contents

Use

Raphaël is used by first creating an instance of the Raphaël object, which manages the creation of the canvas. The following examples create a canvas that is 320 pixels wide and 200 pixels high:

// top left of canvas at the viewport's 10,50 coordinate
var r = Raphael(10, 50, 320, 200); 
 
// top left of canvas at the  top left corner of the #example element (in elements where dir="ltr")
var r = Raphael(document.getElementById("example"), 320, 200);
 
// same as above
var r = Raphael("example", 320, 200);

Once the Raphaël object has been instantiated, its various drawing, resizing and animation methods may be called to build up a vector graphic. This library includes support of Cùfon fonts, a format that turns a given font into a set of vector paths. It is extensible through plugins.

Usage

Raphaël is used by the Evri widget to create cross-browser vector graphics. The widget is used on the Washington Post and the Times Online websites.

Raphaël is also used by iCloud.com[1], and by the White House[2].

References

  1. ^ The JavaScript code if iCloud.com, including Raphael
  2. ^ Raphaël in White House: “we (@massrelevance) used @raphaeljs 2.0 for the map viz used during the #AskObama event today http://t.co/EcqROIi”

External links